package com.sk.coin.sys.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sk.coin.sys.entity.WorkIssue;
import com.sk.coin.sys.mapper.WorkIssueMapper;
import com.sk.coin.sys.service.IWorkIssueService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 工单记录 服务实现类
 * </p>
 *
 * @author Administrator
 * @since 2022-02-21
 */
@Service
public class WorkIssueServiceImpl extends ServiceImpl<WorkIssueMapper, WorkIssue> implements IWorkIssueService {

    @Override
    public Page<WorkIssue> findByPage(Page<WorkIssue> page, Integer status, String startTime, String endTime) {
        return page(page, new LambdaQueryWrapper<WorkIssue>().eq(status != null, WorkIssue::getStatus, status)
                .between(StringUtils.isNotEmpty(startTime) && StringUtils.isNotEmpty(endTime), WorkIssue::getCreated, startTime, endTime + " 23:59:59"));
    }
}
